//
//  LSMineCenterLabelCell.m
//  LaSaCivilAffairsDepartment
//
//  Created by 聂志康 on 2018/12/20.
//  Copyright © 2018 wpkj. All rights reserved.
//

#import "LSMineCenterLabelCell.h"

@interface LSMineCenterLabelCell ()
@property (nonatomic, strong) UILabel *centerLabel;
@end

@implementation LSMineCenterLabelCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 10)];
        lineView.backgroundColor = hexColor(EEEEEE);
        [self.contentView addSubview:lineView];
        [self.contentView addSubview:self.centerLabel];
    }
    return self;
}

- (void)setCenterLabelText:(NSString *)centerLabelText {
    _centerLabelText = centerLabelText;
    self.centerLabel.text = centerLabelText;
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
    [super setHighlighted:highlighted animated:animated];
    WS
    if (highlighted) {
        if (animated) {
            [UIView animateWithDuration:0.5 animations:^{
                [weakSelf.contentView setBackgroundColor:hexColor(d9d9d9)];
            }];
        } else {
            [weakSelf.contentView setBackgroundColor:hexColor(d9d9d9)];
        }
    } else {
        if (animated) {
            [UIView animateWithDuration:0.5 animations:^{
                [weakSelf.contentView setBackgroundColor:UIColor.whiteColor];
            }];
        } else {
            [weakSelf.contentView setBackgroundColor:UIColor.whiteColor];
        }
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    WS
    if (selected) {
        if (animated) {
            [UIView animateWithDuration:0.5 animations:^{
                [weakSelf.contentView setBackgroundColor:hexColor(d9d9d9)];
            }];
        } else {
            [weakSelf.contentView setBackgroundColor:hexColor(d9d9d9)];
        }
    } else {
        if (animated) {
            [UIView animateWithDuration:0.5 animations:^{
                [weakSelf.contentView setBackgroundColor:UIColor.whiteColor];
            }];
        } else {
            [weakSelf.contentView setBackgroundColor:UIColor.whiteColor];
        }
    }
}

- (UILabel *)centerLabel {
    if (!_centerLabel) {
        _centerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, ScreenWidth, LSMineCenterLabelCellHeight-10)];
        _centerLabel.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:15];
        _centerLabel.textColor = hexColor(666666);
        _centerLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _centerLabel;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

@end
